#include <iostream>
#include "timer.h"

class Solution {
public:
    int trailingZeroes(int n) {
        int count = 0;
        int number = 1;
        while (number * 5 <= n) {
            count = count * 5 + 1;
            number *= 5;
        }
        int ret = 0;
        while (count > 0) {
            ret += (n / number) * count;
            n = n % number;
            number /= 5;
            count = (count - 1) / 5;
        }
        return ret;
    }
};